/*
 * PublicImagesServer.java
 *
 * Created on 24 październik 2007, 18:36
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package info.mikrotubula.server;

import org.apache.log4j.Logger;
import org.restlet.Restlet;
import org.restlet.data.MediaType;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.FileRepresentation;

/**
 *
 * @author Krystian
 */
public class PublicImagesServer extends Restlet {
    static Logger logger = Logger.getLogger(PublicImagesServer.class);
    
    /** Creates a new instance of PublicImagesServer */
    public PublicImagesServer() {
    }
    
    @Override
    public void handle(Request request, Response response) {
                logger.info("Public Images Server handle");
                String imageSource;
                imageSource = (String) request.getAttributes().get("imageSource");
                FileRepresentation file = new FileRepresentation(ServerProperties.getProperties("images.location") + imageSource, MediaType.IMAGE_ALL, 3600);
                response.setEntity(file);
    }
}
